<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>检测浏览器 | 赤子英金 | 2023级12班研究性学习</title>
  <style>
    body {
      display: flex;
      align-items: center;
      justify-content: center;
    }

  .message {
      text-align: center;
    }
  </style>
  <script>
    // 检测是否为微信浏览器
    function isWeChatBrowser() {
      var ua = navigator.userAgent.toLowerCase();
      return ua.match(/micromessenger/i) =='micromessenger';
    }

    function copyToClipboard() {
      var text = 'https://project.chiziingiin.top/';
      var tempInput = document.createElement('input');
      tempInput.value = text;
      document.body.appendChild(tempInput);
      tempInput.select();
      document.execCommand('copy');
      document.body.removeChild(tempInput);
      alert('已复制到剪贴板！');
    }

    window.onload = function () {
      if (isWeChatBrowser()) {
        var div = document.createElement('div');
        div.className ='message';
        div.innerHTML = '请复制 <a href="https://project.chiziingiin.top/">https://project.chiziingiin.top/</a> 到浏览器打开<br>默认用户test 密码123456<button onclick="copyToClipboard()">复制</button>';
        document.body.appendChild(div);
      } else {
        window.location.href = 'https://project.chiziingiin.top/';
      }
    }
  </script>
</head>

<body>

</body>

</html>